<?php namespace Clases;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Usuario
 *
 * @author payo
 */
require_once('arquitectura/AbstractJirach.php');
require_once('Clases/Reporte.php');
class Alumno extends AbstractJIrach{

    public $Matricula;
    public $NombreCompleto;
    public $Nomina;

    public function LlenarAlumno($Matricula,$Nomina, $NombreCompleto) {
        $this->Nomina = $Nomina;
        $this->NombreCompleto = $NombreCompleto;
        $this->Matricula = $Matricula;
        $this->insertar();
    }

    public function __construct()
    {
        parent::AbstractJirach();
    }

    protected function Comandos() {
        $this->id = "Matricula";
        $this->tabla = "`alumno`";
        $this->strDelete = "DeleteAlumno";
        $this->strInsertar = "InsertarAlumno";
        $this->strInsertarId = "InsertarIdAlumno";
        $this->strUpdate = "UpdateAlumno";
    }
    protected function fillJirach($row) {

        $row = mysql_fetch_row($row);
        $x = -1;
        $this->Matricula = $row[++$x];
        $this->NombreCompleto = utf8_encode($row[++$x]);
        $this->Nomina = utf8_encode($row[++$x]);
    }

    public function get($id) {
        $abs = AbstractJirach::getAbstractJirach(new Alumno(),$id,$this->tabla,$this->id);
        return $abs;
    }

    public function getAll() {
        $abs = AbstractJirach::getAllAbstract($this->tabla,$this->id,new Alumno());
        return $abs;
    }
    public function getAtributos() {
        $lst = array();
        array_push($lst,$this->Matricula);
        array_push($lst,$this->NombreCompleto);
        array_push($lst,$this->Nomina);
        return $lst;
    }
    
    public function numeroReportes()
    {
        $val = new Reporte();
        $matricula = "'".$this->Matricula."'";
        $reportes = $val->getAllFrom("count(IdReporte)", "`reporte`", "Matricula", $matricula, null);
        return $reportes[0];
    }
    
}

?>
